//
//  CALayer+PopAnimation.h
//  XYZKitDemo
//
//  Created by 谢英泽 on 16/11/24.
//  Copyright © 2016年 谢英泽. All rights reserved.
//

#import <QuartzCore/QuartzCore.h>

extern NSString * const kLayerBackgroundColor;
extern NSString * const kLayerBounds;
extern NSString * const kLayerCornerRadius;
extern NSString * const kLayerBorderWidth;
extern NSString * const kLayerBorderColor;
extern NSString * const kLayerOpacity;
extern NSString * const kLayerPosition;
extern NSString * const kLayerPositionX;
extern NSString * const kLayerPositionY;
extern NSString * const kLayerRotation;
extern NSString * const kLayerRotationX;
extern NSString * const kLayerRotationY;
extern NSString * const kLayerScaleX;
extern NSString * const kLayerScaleXY;
extern NSString * const kLayerScaleY;
extern NSString * const kLayerSize;
extern NSString * const kLayerSubscaleXY;
extern NSString * const kLayerSubtranslationX;
extern NSString * const kLayerSubtranslationXY;
extern NSString * const kLayerSubtranslationY;
extern NSString * const kLayerSubtranslationZ;
extern NSString * const kLayerTranslationX;
extern NSString * const kLayerTranslationXY;
extern NSString * const kLayerTranslationY;
extern NSString * const kLayerTranslationZ;
extern NSString * const kLayerZPosition;
extern NSString * const kLayerShadowColor;
extern NSString * const kLayerShadowOffset;
extern NSString * const kLayerShadowOpacity;
extern NSString * const kLayerShadowRadius;

typedef void(^kPopComplete)(id obj, BOOL finish);

@interface CALayer (PopAnimation)

#pragma mark - Basic动画

- (void)layerBasicPopWithName:(NSString *)propertyNamed to:(id)toValue duration:(CGFloat)duration key:(NSString *)key complete:(kPopComplete)complete;

- (void)layerBasicPopWithName:(NSString *)name from:(id)fromValue to:(id)toValue duration:(CGFloat)duration key:(NSString *)key complete:(kPopComplete)complete;

#pragma mark - Spring动画

- (void)layerSpringPopWithName:(NSString *)propertyNamed to:(id)toValue bounce:(CGFloat)bounce speed:(CGFloat)speed key:(NSString *)key complete:(kPopComplete)complete;

- (void)layerSpringPopWithName:(NSString *)propertyNamed to:(id)toValue bounce:(CGFloat)bounce speed:(CGFloat)speed key:(NSString *)key times:(id)times complete:(kPopComplete)complete;

- (void)layerSpringPopWithName:(NSString *)propertyNamed from:(id)fromValue to:(id)toValue bounce:(CGFloat)bounce speed:(CGFloat)speed key:(NSString *)key complete:(kPopComplete)complete;

#pragma mark - Decay动画

/**
 衰减动画

 @param propertyNamed 动画属性
 @param fromValue 变化开始值
 */
- (void)layerDecayPopWithName:(NSString *)propertyNamed fromValue:(id)fromValue;

#pragma mark - 移除动画

- (void)layerRemoveAllAnimations;

#pragma mark - 震动动画
/**
 水平震动动画
 */
- (void)layerShakeHorizontal;
/**
 垂直震动动画
 */
- (void)layerShakeVertical;

- (void)layerShakeVerticalSlow;

#pragma mark - Pop经典动画

- (void)layerPopClassics;

- (void)layerPopClassicsWithTimes:(id)times;

- (void)layerPopClassicsWithTimes:(id)times completed:(kPopComplete)completed;

- (void)layerPopScaleY;

- (void)layerPopScaleY:(id)repeatCount;

- (void)layerStopPopClassics;

@end
